﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../jquery-1.8.0.js" type="text/javascript"></script>
    <style type="text/css">
        div
        {
            width: 150px;
            height: 150px;
            position: absolute;
            left: 220px;
            top: 135px;
            background-color: #FF0000;
            cursor: pointer;
        }
    </style>
    <script type="text/javascript">
        //window.event              event
        //attachEvent               addEventListener
        //window.event.srcElement   e.target
        //window.event.returnvalue  e.preventDefault();
        //e.stopPropartion          canBo
        $(function () {
            $(document.documentElement).bind("click", function (event) {
                if (event.target.id == "imgWeixin") {
                    if ($("#bWeixin").css("display") == "block") {
                        $("#bWeixin").css("display", "none");
                    } else {
                        $("#bWeixin").css("display", "block");
                        var offset = $("#imgWeixin").offset();
                        $("#bWeixin").css("left", parseInt(offset.left) + $("#imgWeixin").width());
                    }
                } else {
                    $("#bWeixin").css("display", "none");
                }

            });
        }); 


        alert(typeof event); //IE Object
   
        function getEvent(event) {
            return event || window.event;
        }
        window.onload = function () {
            var div = document.getElementById("div");
            div.onclick = function (e) {
                alert((event || window.event).type);
            };

        };
    </script>
</head>
<body>
    <div id="div">
        Div
    </div>

</body>
</html>
